package com.twu.biblioteca;

public class MembershipDetails extends MenuOption {

    private User user;

    protected MembershipDetails(String name, User user) {
        super(name);
        this.user = user;
    }

    @Override
    protected String menuOptionHeader() {
        return "\nMEMBERSHIP DETAILS\n";
    }

    @Override
    protected String menuOptionBody() {
        if(isUserLoggedIn()){
             return user.getMembershipDetails();
        }
        return "Please talk to a Librarian. Thank you.\n";
    }

    @Override
    protected String getResponse() {
        return menuOptionHeader()+menuOptionBody();
    }

    @Override
    protected boolean hasSubMenu() {
        return false;
    }

    private boolean isUserLoggedIn() {
        if (user != null) return true;
        return false;
    }
}
